<?php

namespace app\admin\model;

use think\Model;
use think\facade\Env;
class Ad extends Model
{
    protected static function init()
    {
        self::afterDelete(function ($data) {
            self::delpic($data['pic']);
        });
    }
    /**
     * 单张图片删除
     */
    public static function delpic($url=""){
        $path=Env::get('root_path')."\\public\\". $url;
        if ($url!==""||!empty($url)) {
            if(file_exists($path)) {
                $res=unlink($path);
                
            }
        }
        
    }
}
